<template>
	<view>
		<view class="content">
			<view class="school" >
				职位名称
			</view>
			<input type="text" value="" v-model="form.job_name" placeholder="请输入公司名称"  />
		</view>
		<view class="content" @click="show=true">
			<view class="school" >
				职位类别
			</view>
			<input type="text" disabled="true" value="" v-model="job_type" placeholder="请选择职位类别"  />
		</view>
		<view class="content" @click="showw=true">
			<view class="school" >
				月薪待遇
			</view>
			<input type="text" disabled="true" value="" v-model="treatment_type" placeholder="请选择月薪待遇"  />
		</view>
		<view class="content" @click="fw=true">
			<view class="school" >
				资薪范围
			</view>
			<input type="text" disabled="true" value="" v-model="salary_range_type" placeholder="请选择资薪范围"  />
		</view>
		<view class="content" @click="bumen=true">
			<view class="school" >
				所属部门
			</view>
			<input type="text" disabled="true" value="" v-model="department_type" placeholder="请选择所属部门"  />
		</view>
		<view class="content">
			<view class="school" >
				招聘人数
			</view>
			<input type="text" value="" v-model="form.recruiting_num" placeholder="请填写招聘人数"  />
		</view>
		<view class="content" @click="work=true">
			<view class="school" >
				工作经验
			</view>
			<input type="text" disabled="true" value="" v-model="work_experience_type" placeholder="请选择工作经验"  />
		</view>
		<view class="content" @click="xl=true">
			<view class="school" >
				学历
			</view>
			<input type="text"  disabled="true" value="" v-model="edu_type" placeholder="请选择学历"  />
		</view>
		<view class="content">
			<view class="school" >
				年龄
			</view>
			<input type="text" value="" v-model="form.age_type" placeholder="请选择年龄"  />
		</view>
		<view class="content" @click="xx=true">
			<view class="school" >
				性别
			</view>
			<input type="text" disabled="true" value="" v-model="sex_type" placeholder="请选择性别"  />
		</view>
		<view class="content">
			<view class="school" >
				发布时常
			</view>
			<input type="text" value="" v-model="form.send_day" placeholder="请填写天数"  />
		</view>
		<view class="content">
			<view class="school" >
				岗位描述
			</view>
			<input type="text" value="" v-model="form.job_des" placeholder="请填写岗位描述"  />
		</view>
		<view class="content" @click="fl=true">
			<view class="school" >
				亮点福利
			</view>
			<input type="text" value="" v-model="highlight_type" placeholder="请选择福利待遇"  />
		</view>
		<view class="content">
			<view class="school" >
				工作地区
			</view>
			<area2 :p_id="0" :c_id="0" @back_func_op="b1"></area2>
		</view>
		<view class="content">
			<view class="school" >
				面试地址
			</view>
			<input type="text" value="" v-model="form.interview_address" placeholder="请填写面试地址"  />
		</view>
		<view class="content">
			<view class="school" >
				联系人
			</view>
			<input type="text" value="" v-model="form.link_name" placeholder="请填写联系人"  />
		</view>
		<view class="content">
			<view class="school" >
				联系电话
			</view>
			<input type="text" value="" v-model="form.link_mobile" placeholder="请填写电话"  />
		</view>
		<view class="content">
			<view class="school" >
				企业邮箱
			</view>
			<input type="text" value="" v-model="form.link_email" placeholder="请填写邮箱地址"  />
		</view>
		<view class="btn">
			<view class="dl" @click="baocun">
				<view class="dll">
					保存
				</view>
			</view>
		</view>
		<image-picker :hide="true" ref="imgPicker" :count="1" @success="upSuccess"></image-picker>
		<imgg :hide="true" ref="imgg" :count="1" @success="upSuccesss"></imgg>
		<zizhi :hide="true" ref="zizhi" :count="1" @success="upSuccessss"></zizhi>
		<u-select mode="single-column" v-model="show" :list="list" @confirm="confirm"></u-select>
		<u-select mode="single-column" v-model="showw" :list="listt" @confirm="confirmm"></u-select>
		<u-select mode="single-column" v-model="fw" :list="listfw" @confirm="confirmfw"></u-select>
		<u-select mode="single-column" v-model="bumen" :list="listbumen" @confirm="confirmbumen"></u-select>
		<u-select mode="single-column" v-model="work" :list="listwork" @confirm="confirmwork"></u-select>
		<u-select mode="single-column" v-model="xl" :list="listxl" @confirm="confirmxl"></u-select>
		<u-select mode="single-column" v-model="xx" :list="listxx" @confirm="confirmxx"></u-select>
		<u-select mode="single-column" v-model="fl" :list="listfl" @confirm="confirmfl"></u-select>
	</view>
</template>

<script>
	import {mapState,mapMutations} from 'vuex';
	import ImagePicker from '@/components/image-picker.vue';
	import imgg from '@/components/image-picker.vue';
	import zizhi from '@/components/image-picker.vue';
	import area2 from '@/pages/my/enterprise/area_two.vue'
	export default {
		components: {
			ImagePicker,
			imgg,
			zizhi,
			area2
		},
		data() {
			return {
				// a:true,
				// b:true,
				// c:true,
				form:{},
				show:false,
				job_type:'',
				treatment_type:'',
				salary_range_type:'',
				department_type:'',
				work_experience_type:'',
				edu_type:'',
				sex_type:'',
				highlight_type:'',
				list: [
					// {
					// 	value: '0',
					// 	label: '未知'
					// },
					// {
					// 	value: '2',
					// 	label: '私企'
					// },
					// {
					// 	value: '3',
					// 	label: '国企'
					// },
				],
				showw:false,
				listt:[],
				fw:false,
				listfw:[],
				bumen:false,
				listbumen:[],
				work:false,
				listwork:[],
				xl:false,
				listxl:[],
				xx:false,
				listxx:[],
				fl:false,
				listfl:[]
			}
		},
		// computed: mapState(['stateData']),
		created() {
			// this.chakan()
			let self=this;
			uni.getStorage({
			    key: 'stateData',
			    success: function (res) {
			        self.stateData=res.data
					console.log(self.stateData,"静态数据")
					self.jt()
			    }
				
			});
			// this.jt()
		},
		onLoad() {
		},
		methods: {
			async chakan(){
				const res = await this.post('/Index/UserCompany/get_user_company');
				// this.form=res.data
				// this.enterprise_type=this.form.enterprise_type_name
				// this.scale_type=this.form.scale_type_type_name
			},
			jt(){
				for(let i in this.stateData.job_type){
					this.list.push({value:i,label:this.stateData.job_type[i]})
				}
				for(let i in this.stateData.treatment_type){
					this.listt.push({value:i,label:this.stateData.treatment_type[i]})
				}
				for(let i in this.stateData.salary_range_type){
					this.listfw.push({value:i,label:this.stateData.salary_range_type[i]})
				}
				for(let i in this.stateData.department_type){
					this.listbumen.push({value:i,label:this.stateData.department_type[i]})
				}
				for(let i in this.stateData.work_experience_type){
					this.listwork.push({value:i,label:this.stateData.work_experience_type[i]})
				}
				for(let i in this.stateData.edu_type){
					this.listxl.push({value:i,label:this.stateData.edu_type[i]})
				}
				for(let i in this.stateData.sex_type){
					this.listxx.push({value:i,label:this.stateData.sex_type[i]})
				}
				for(let i in this.stateData.highlight_type){
					this.listfl.push({value:i,label:this.stateData.highlight_type[i]})
				}
				
			},
			async baocun() {
				this.form.area_id=1;
				const res = await this.post('/Index/UserCompany/send_job', this.form);
				console.log(res)
				if(res.code==200){
					uni.showToast({
						title:'添加成功',
						duration:1000,
						icon:'none',
						success() {
							uni.navigateBack({
								
							})
						}
					})
				}
				console.log(res)
			},
			confirm(e){
				console.log(e)
				this.form.job_type=e[0].value;
				this.job_type=e[0].label;
			},
			confirmm(e){
				console.log(e)
				this.form.treatment_type=e[0].value;
				this.treatment_type=e[0].label;
			},
			confirmfw(e){
				console.log(e)
				this.form.salary_range_type=e[0].value;
				this.salary_range_type=e[0].label;
			},
			confirmbumen(e){
				console.log(e)
				this.form.department_type=e[0].value;
				this.department_type=e[0].label;
			},
			confirmwork(e){
				console.log(e)
				this.form.work_experience_type=e[0].value;
				this.work_experience_type=e[0].label;
			},
			confirmxl(e){
				console.log(e)
				this.form.edu_type=e[0].value;
				this.edu_type=e[0].label;
			},
			confirmxx(e){
				console.log(e)
				this.form.sex_type=e[0].value;
				this.sex_type=e[0].label;
			},
			confirmfl(e){
				console.log(e)
				this.form.highlight_type=e[0].value;
				this.highlight_type=e[0].label;
			},
			
			logo(){
				this.$refs.imgPicker.ChooseImage()
			},
			zp(){
				this.$refs.imgg.ChooseImage()
			},
			qyzz(){
				this.$refs.zizhi.ChooseImage()
			},
			upSuccess(res) {
				console.log(res.file)
				// 选择完成图片回调返回 res.file 就是上传成功后端返回来的图片路径
				this.form.logo = res.file;
				this.a=false
			},
			upSuccesss(res) {
				console.log(res.file)
				// 选择完成图片回调返回 res.file 就是上传成功后端返回来的图片路径
				this.form.company_pic = res.file;
					this.b=false
			},
			b1(e){
				console.log("b1:")
				console.log(e)
				this.form.area_id=e.c_id
				this.form.province_id=e.p_id
			},
			upSuccessss(res) {
				console.log(res.file)
				// 选择完成图片回调返回 res.file 就是上传成功后端返回来的图片路径
				this.form.enterprise_certification_pic = res.file;
					this.c=false
			},
		}
	}
</script>

<style lang="scss" scoped>
	.btn{
		width: 100%;
		// display: flex;
		align-items: center;
		justify-content: space-around;
}
	.dl {
		width: 100%;
		padding: 30rpx;
		// transform: translateX(-50%);
		.dll {
			width: 100%;
			height: 90rpx;
			color: #FFFFFF;
			line-height: 90rpx;
			text-align: center;
			border-radius: 15rpx;
			background-color: #3291F8;
			border: 1rpx solid #3291F8;
		}
		.dlll{
			width: 100%;
			height: 90rpx;
			color: #ff0000;
			line-height: 90rpx;
			text-align: center;
			border-radius: 15rpx;
			background-color: #FFFFFF;
			border: 1rpx solid #ff0000;
		}
	}
	.content {
		padding: 30rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1rpx solid #bcbcbc;
		font-size: 25rpx;
		.school{
			width: 250rpx;
		}
		input{
			width: calc(100% - 250rpx);
			font-size: 25rpx;
			text-align: right;
		}
		
		// padding: 20rpx 0;
	}
</style>
